/**
 * 认证审核
 */
<template>
  <div>
    <div v-if="isUser">
      <!-- 面包屑导航 -->
      <el-breadcrumb separator-class="el-icon-arrow-right" class="margin-t10">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>{{ fatherName }}</el-breadcrumb-item>
      </el-breadcrumb>
      <div class="boxBlock"> 
        <div class="serachTop"> 
             <!-- 搜索筛选 -->
            <el-form :inline="true" :model="formInline" class="user-search">
              <el-form-item  >
                <el-input
                  size="small"
                  v-model="formInline.userId"
                  placeholder="输入用户ID"
                  type="number"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item>
                <el-select
                  size="small"
                  v-model="formInline.status"
                  placeholder="请选择审核状态"
                  clearable
                >
                  <el-option label="请选择审核状态" value=""></el-option>
                  <el-option
                    v-for="type in statusData"
                    :label="type.key"
                    :value="type.value"
                    :key="type.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button
                  size="small"
                  type="primary"
                  icon="el-icon-search"
                  @click="search"
                >
                  搜索
                </el-button>
              </el-form-item>
            </el-form>
        </div>
     
     
      <!--列表-->
      <div class="ra_box">
        <el-table
          size="small"
          :data="listData"
          highlight-current-row
          v-loading="loading"
          element-loading-text="拼命加载中"
          style="width: 100%"
        >
          <el-table-column prop="userId" label="用户ID" width="80">
          </el-table-column>
          
          <el-table-column prop="certificateName" label="姓名"> </el-table-column>
          <el-table-column prop="phone" label="手机号" show-overflow-tooltip>
            
          </el-table-column>
          <el-table-column
            prop="createBy"
            label="操作人"
            show-overflow-tooltip
            width="120"
          >
         </el-table-column>
          <el-table-column
            prop="companyName"
            label="公司名称"
            show-overflow-tooltip
          >
          </el-table-column>
          <el-table-column prop="status" label="审核状态" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>{{ statusData[scope.row.status].key }}</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="createTime"
            label="创建时间"
            show-overflow-tooltip
          >
            <template slot-scope="scope">
              {{ timestampToTime(scope.row.createTime) }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作" width="300">
            <template slot-scope="scope">  
              <el-button size="mini" type="success" v-if="scope.row.status == 0" plain @click="changUser(false, scope.row)" >   
                 审核 
              </el-button>  
              <el-button size="mini" plain v-else @click="changUser(false, scope.row)" >   
                 <label >查看</label>
              </el-button>  
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 分页组件 -->
      <Pagination
        v-bind:child-msg="pageparm"
        @callFather="callFather"
      ></Pagination>
    </div>
  </div>
    <div v-else>
      <userItem
        @changUser="changUser"
        :isUser="isUser"
        :approveInfo="approveInfo"
        :fatherName="fatherName"
      ></userItem>
    </div>
  </div>
</template>

<script>
import { mapState, mapGetters } from "vuex";
import {
  setStoreS,
  getStoreS,
  removeStoreS,
  insertCharacter,
  timestampToTime,
  spStr,
} from "../../utils/util";
import {
  baseURL,
  req,
  service,
  encrypt,
  decrypt,
  reqtoken,
  reqField,
  format,
  getUrl,
} from "../../api/axiosFun";
import Pagination from "../../components/Pagination";
import userItem from "./userItem.vue";
export default {
  data() {
    return {
      isUser: true,
      loading: false,
      disabled: false,
      addFormVisible: false,
      fatherName: "认证审核",
      b: format,
      timestampToTime: timestampToTime,
      statusData: [
        { key: "未审核", value: 0 },
        { key: "通过", value: 1 },
        { key: "驳回", value: 2 },
      ],
      formInline: {
        pageNum: 1,
        pageSize: 10,
        status: "",
      },
      listData: [],
      pageparm: {
        currentPage: 1,
        pageSize: 10,
        total: 10,
      },
    };
  },
  // 注册组件
  components: {
    Pagination,
    userItem,
  },
  created() {
    this.getdata(this.formInline);
  },
  methods: {
    getdata(parameter) {
      let url = getUrl(parameter);
      service
        .get("/api/admin/getAuthRecordKycList" + url, {})
        .then((res) => {
          this.loading = false;
          if (res.code == 0) {
            this.listData = res.rows;
            this.pageparm.currentPage = this.formInline.pageNum;
            this.pageparm.pageSize = this.formInline.pageSize;
            this.pageparm.total = res.total;
          } else {
            this.$message({
              type: "info",
              message: spStr(res.msg, "PhotonPay", ""),
            });
          }
        })
        .catch((err) => {
          this.loading = false;
          this.$message.error(spStr(err, "PhotonPay", ""));
        });
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.pageNum = parm.currentPage;
      this.formInline.pageSize = parm.pageSize;
      this.getdata(this.formInline);
    },
    // 搜索事件
    search() {
      this.getdata(this.formInline);
    },
    changUser(k, row) {
      this.isUser = k;
      this.approveInfo = row;
      if (k) {
        this.getdata(this.formInline);
      }
    },
  },
};
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>

 
 